<?php
include '../comm/config.php';
include_once '../comm/checkpostandget.php';
if (UC == 1) {
	include '../data/config.inc.php';
	include '../uc_client/client.php';
	
	$name=trim($_GET["name"]);
	$uc_name=iconv("utf-8","utf-8",$name);
	$ucresult = uc_user_checkname($uc_name);
	
	echo $ucresult;  //1表示可用  -1表示不合法  -2表示包含不允许注册的词语  -3表示已存在
	
} else {
	$uname = trim($_GET["name"]);
	if ($uname == ''||$uname=='网站客服') {
		echo -1;//用户名不合法
	} else {
		$con = @ mysql_connect("$dbserver", "$dbuser", "$dbpass") or die(ERR_DB);
		mysql_select_db("$dbname", $con) or die("can not choose the dbname!");
		$query = "select * from " . $BIAOTOU . "user where ddusername='" . $uname . "'";
		mysql_query("set names utf8");
		$res = mysql_query($query);
		if (mysql_num_rows($res) != 0) {
			echo -3;//用户名已存在
		} else {
			echo 1;//用户名可用
		}
	}
}
mysql_close();
?>